#!/bin/bash
# SPDX-License-Identifier: MulanPSL-2.0+
# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.

if [ $# -lt 1 ] || [ $# -gt 2 ]; then
  echo "USAGE: $0 id                  # hdel for id2content"
  echo "     : $0 queues/your_key id  # hdel for your key's"
  exit 1
fi

if [[ $2 ]]; then
  key_name=$1
  id=$2
else
  key_name=queues/id2content
  id=$1
fi

# use current filename's last string as lua command script
cmd_lua=${0##*_}

redis-cli --eval key_cmd_params.lua $key_name , $cmd_lua $id
